#include <Windows.h>
#include <iostream>

typedef	int(*FUNA)(int&, int&);
typedef int(*FUNB)(int&, int&, int&);

int main(int argc, TCHAR *argv[])
{
	PCTSTR dllName = TEXT("createDLL.dll");
	LPCSTR funName1 = "?printMax@@YAHAAH00@Z";
	LPCSTR funName2 = "?printMax@@YAHAAH0@Z";

	int x(100), y(100), z(100);

	HMODULE hDLL = LoadLibrary(dllName);
	
	if (hDLL != NULL)
	{
		FUNA fp1 = FUNA(GetProcAddress(hDLL, funName1));
		if (fp1 != NULL)
		{
			std::cout << "Input 2 Numbers" << std::endl;
			std::cin >> x >> y;
			std::cout << fp1(x, y) << std::endl; 
		}
		else
		{
			std::cout << "Cannot Find Function" << funName1 << std::endl;
		}

		FUNB fp2 = FUNB(GetProcAddress(hDLL, funName1));
		if (fp2 != NULL)
		{
			std::cout << "Input 3 Numbers" << std::endl;
			std::cin >> x >> y >> z;
			std::cout<< fp2(x, y, z) << std::endl;
		}
		else
		{
			std::cout << "Cannot Find Function" << funName2 << std::endl;
		}
		FreeLibrary(hDLL);
	}
	else
	{
		std::cout << "Can't find " << dllName << std::endl;
	}

	return 0;
}